Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Displaying Rendered • View rawDownload


index.mu HEAD (13cc24bf) Text, 1.22 KB

import core
import os

if 'link_id' not in os.environ:
os.environ['link_id'] = 'local_test'

if 'remote_identity' in os.environ:
user_identity = core.check_identity(os.environ['remote_identity'])
if user_identity != None:
user_data = core.read_user_id(user_identity[1]['user_id'])
user = core.read_users()[user_data['username']]
core.add_active_session(os.environ['link_id'], user_identity[1]['user_id'], user_data, user['role'])
current_session = core.get_current_session(os.environ['link_id'])

core.trim_active_sessions()

core.header(current_session)

if current_session:
print('''
Welcome
Welcome to the homepage!

You are logged in. Congratulations!

Here is some secret stuff for authenticated users.

''')
if not current_session:
print('''
Welcome Guest
Welcome to the homepage! Please log in.

''')

core.footer()


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────